﻿CREATE TABLE [dbo].[WorkLog] (
    [ID]         INT              IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
    [GID]        UNIQUEIDENTIFIER CONSTRAINT [DF_WorkLog_GID] DEFAULT (newid()) NOT NULL,
    [Title]      NVARCHAR (200)   NULL,
    [Content]    VARCHAR (MAX)    NULL,
    [CreateTime] DATETIME         CONSTRAINT [DF_Table_1_CreateDate] DEFAULT (getdate()) NULL,
    [EditTime]   DATETIME         CONSTRAINT [DF_Table_1_ModifyTime] DEFAULT (getdate()) NULL,
    [UserName]   NVARCHAR (50)    NOT NULL,
    [Name]       NVARCHAR (50)    NULL,
    [CompanyId]  INT              NULL,
    [DepId]      INT              NULL,
    [LogType]    INT              NULL,
    CONSTRAINT [PK_WorkLog] PRIMARY KEY NONCLUSTERED ([ID] ASC)
);


GO
CREATE NONCLUSTERED INDEX [IX_WorkLog_GID]
    ON [dbo].[WorkLog]([GID] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_WorkLog_CreateTime]
    ON [dbo].[WorkLog]([CreateTime] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_WorkLog_CompanyId]
    ON [dbo].[WorkLog]([CompanyId] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_WorkLog_DepId]
    ON [dbo].[WorkLog]([DepId] ASC);


GO
CREATE NONCLUSTERED INDEX [idx_WorkLog_CreateTime_IncludeIndex]
    ON [dbo].[WorkLog]([CreateTime] ASC, [LogType] ASC)
    INCLUDE([Title], [Name], [CompanyId], [DepId]);

